<?php
/*
 * [JINYUN!] (C)2001-2099 Jinyunweb.com
 * This is NOT a freeware, use is subject to license terms
 *售后列表
*/
defined('BY_JYA') or exit('error');
$_RQ['op']=$_RQ['op']?$_RQ['op']:'list';

$tabs=array(
	array('op'=>'list','title'=>'满意度调查'),
);
//售后列表
if($_RQ['op']=='list' || $_RQ['op']=='from'){
	$pindex = max(1, intval($_RQ['page']));
	$psize = 10;
	$return['params']=array();
	$params=array('storeid'=>$_SESSION['storeid'],'uniacid'=>$_SESSION['uniacid']);
	$return['params']['type']=$_RQ['type'];
	if($_RQ['id']){
		$this->session('datiid',intval($_RQ['id']));
	}
	if($_RQ['op']=='from' && $this->session('datiid')){
		$params['datiid']=$this->session('datiid');
		$return['params']['id']=$params['datiid'];
	}
	if($_RQ['storeid']){
		$params['storeid']=intval($_RQ['storeid']);
		$return['params']['storeid']=$_RQ['storeid'];
	}
	if(!empty($_RQ['title'])){
		$params['title like']='%'.$_RQ['title'].'%';
		$return['params']['title']=$_RQ['title'];
	}
	$pindex = max(1, intval($_RQ['page']));
	$psize = $_RQ['psize']?:10;
	$list=pdo_getslice('jy_yxw_diaocha_log',$params,array($pindex,$psize),$total,$fields,'','id desc');
	if($list){
		foreach($list as &$item){
			$item['member']=$this->model('xuesheng')->member_show($item['xueshengid']);
		}
	}
	$return['list']=$list;
	$totalpage=ceil($total/$psize);
	$totalpage=intval($totalpage);
	$return['totalpage'] =$totalpage;
	$return['params']['page'] =$pindex;
	//页面显示设置
	$htmls=array(
		'type'=>'list',
		'tabs'=>$tabs,
		'list'=>array('data'=>'list','tip'=>'[温馨提示]：
		</br>1、这里显示调查资料！
		','del_message'=>'确认删除该调查吗？','total'=>$total,'psize'=>$psize,'edit'=>false,'del_op'=>'del','html_to'=>'list_html','list'=>array(
			array('name'=>'member','title'=>'用户信息','type'=>'member'),
			array('name'=>'datiid','title'=>'所属问卷','type'=>'select','options'=>'lists'),
			array('name'=>'workerid','title'=>'评分员工','type'=>'select','options'=>'workers'),
			array('type'=>'string','title'=>'评分','name'=>'score'),
			//array('name'=>'status','title'=>'状态','type'=>'radio','options'=>'status'),
			array('name'=>'createtime','title'=>'日期','type'=>'time'),
		),'action'=>array(
			//array('type'=>'model','op'=>'setstore','title'=>'修改门店'),
		),'batch'=>$batch),
		'search'=>array(
			array('type'=>'string','width'=>'15','title'=>'售后姓名','name'=>'title','help'=>''),
			array('name'=>'status','width'=>'15','title'=>'状态','type'=>'radio','options'=>'status'),
		),
	);
	$return['workers']=$this->getall('worker',array('storeid'=>$_SESSION['storeid'],'uniacid'=>$_SESSION['uniacid']),array('id','title'),'id');	
	$return['lists']=$this->getall('diaocha_list',array('storeid'=>$_SESSION['storeid'],'uniacid'=>$_SESSION['uniacid']),array('id','title'),'id');	
	$return['status']=$this->member_status;
	$return['htmls']=$htmls;
	exi($return);
}
if($_RQ['op']=='del'){
	$del=trim($_RQ['del'],';');
	if($del){
		$del=explode(';',$del);
	}else{
		$del=array();
	}
	if($_RQ['id']){
		$del[]=$_RQ['id'];
	}
	foreach($del as $id){
		$id=intval($id);
		if($id){
			pdo_delete('jy_yxw_diaocha_log',array('id'=>$id,'uniacid'=>$_SESSION['uniacid']));
		}
	}
	exi('删除成功！');
}